﻿@using brand.cyt369.com.MODELS
@{
    IQueryable<brand.cyt369.com.models.Brand> brands = ViewBag.brands as IQueryable<brand.cyt369.com.models.Brand>;
    int page = ViewBag.page;
    int total = ViewBag.total;
    int totalPage = total / brand.cyt369.com.utility.SystemSettingService.Instance.PageSize;
    int yusu = total % brand.cyt369.com.utility.SystemSettingService.Instance.PageSize;
    if (yusu != 0)
    {
        totalPage++;
    }
}
<input type="hidden" id="currentPage" value="@(page)"/>
<!-- 左边商家列表部分 -->
<div class="serch-main-left fl">
    <div class="Lcont_one">
        <!-- 列表部分 -->
        @if (brands != null&&brands.Count()>0)
        {
            @foreach (var item in brands)
            {
                <ul>
                    <li>
                    <div class="serch-main-left-imgbox fl">
                            <a href="../../Brand/Index/@Base64.ObjectToBase64(new { id = item.Id })" target="_blank">
                                <img width="204" height="162" src="@string.Format("{0}/{1}",brand.cyt369.com.utility.SystemSettingService.Instance.BrandInternalBucket.HttpURL,item.BrandImages[0].ImagePath)" alt="">
                        </a>
                    </div>

                    <div class="serch-main-left-des fl">
                            <h2><a href="../../Brand/Index/@Base64.ObjectToBase64(new { id = item.Id })" target="_blank">@item.Name</a></h2>
                        <div class="serch-main-left-title">
                            <span class="red">@item.Category.Parent.CategoryName</span>
                            <span class="orange">@item.Category.CategoryName</span>
                        </div>

                        <dl>
                            <dt>
                                <em>公司名称：</em>
                                <span>@item.Name</span>
                            </dt>

                            <dd>
                                <em>门店数量：</em>
                                <span>@item.StoreCount 家</span>
                            </dd>
                        </dl>

                        <dl>
                            <dt>
                                <em>所属行业：</em>
                                    <span>
                                        <a style="color:grey;display:inline-block" href="~/Search/Index/@Base64.ObjectToBase64(new { page=1,parentCategoryID=item.Category.ParentID })">@item.Category.Parent.CategoryName</a> >
                                        <a style="color:grey;display:inline-block" href="~/Search/Index/@Base64.ObjectToBase64(new {  page=1,categoryID=item.CategoryID })">@item.Category.CategoryName</a>
                                    </span>
                            </dt>
                            <dd>
                                <em>咨询人数：</em>
                                <span>@item.InquiryCount 人</span>
                            </dd>
                        </dl>

                        <p>@item.Brief</p>
                    </div>

                    <div class="serch-main-left-right fr">
                        <p class="p1">
                                @brand.cyt369.com.MODELS.BrandHelper.GetAmountString(item.Amount)
                        </p>
                        <p class="p2">
                                <a href="../../Brand/Index/@Base64.ObjectToBase64(new { id = item.Id })" target="_blank">加盟咨询</a>
                        </p>
                    </div>
                </li>
            </ul>
            }
     
            <!-- 分页部分 -->
            <div class="serch-pagination">
                <div style="margin: 0 auto;">
                    <a href="javascript:pageChange(1)" class="main-pages">首页</a>
                    <a href="javascript:pageChange(@(page>1?page-1:page))" class="turn-pages">上一页</a>
                    @{
                        int count = 9;//代表展示的页码个数
                        int left = Math.Min(page - 4,totalPage-8);
                        @for(int i = left; i <= totalPage && count >= 1; i++)
                        {
                            if (i >= 1)
                            {
                                <a href="javascript:pageChange(@i)" class='@(i==page?"pages-selected":"")'>@i</a>
                                count--;
                            }
                        }

                    }
                    <a href="javascript:pageChange(@(page<totalPage?page+1:page))" class="turn-pages">下一页</a>
                    <a href="javascript:pageChange(@totalPage)" class="main-pages">末页</a>
                </div>
            </div>
        }
        else
        {
            <div class="no-data">暂无数据</div>
        }
    </div>
</div>
<!-- 右边推荐部分 -->
<div class="serch-main-right fr">
    <div class="Rcont-one">
        <h3>
            <i class="iconfont icon-title"></i>
            <span>推荐品牌</span>
        </h3>
        <ul>
            <li>
                <p class="p1">
                    <a href="" target="_blank">
                        <img src="./image/serch/02.jpg" alt="">
                    </a>
                </p>
                <p class="p2">
                    <a href="" target="_blank">宽窄巷子串串香</a>
                </p>
                <p class="p3">
                    <em>投资金额：</em>
                    <span>10-20万</span>
                    <a href="" target="_blank">加盟咨询</a>
                </p>
            </li>
            <li>

            </li>
            <li>

            </li>
            <li>

            </li>

        </ul>
    </div>
</div>